import Vue from 'vue'
import VueRouter from 'vue-router'


import Login from '../views/login/Login'
import Layout from '../components/layout/Layout'
import PlayerDetail from '../components/common/playerBar/detail/Index.vue'
import Home from '../views/home/Home';
import Rank from '../views/rank/Rank';
import Playlist from '../views/playlist/Playlist';
import PlaylistDetail from '../views/playlist/detail/Index.vue';
import Singer from '../views/singer/Singer';
import SingerDetail from '../views/singer/detail/Index.vue';
// import Video from '../views/video/Video';
import Mv from '../views/mv/Mv';
import MvDetail from '../views/mv/detail/Index.vue';
import Personal from '../views/personal/Index.vue';
import Search from '../views/search/Index.vue';
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    name: 'Login',
    meta: {
      title: '登录',
      isLogin: true
    },
    component: Login
  },
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: 'home',
        name: 'home',
        component: Home
      },
      {
        path: 'rank',
        name: 'rank',
        component: Rank
      },
      {
        path: 'playlist',
        name: 'playlist',
        component: Playlist,
      },
      {
        path: 'playlist-detail',
        name: 'playlistDetail',
        component: PlaylistDetail,
      },
      {
        path: 'singer',
        name: 'singer',
        component: Singer
      },
      {
        path: 'singer-detail',
        name: 'singerDetail',
        component: SingerDetail,
      },
      // {
      //   path: 'video',
      //   name: 'video',
      //   component: Video
      // },
      {
        path: 'mv',
        name: 'mv',
        component: Mv
      },
      {
        path: 'mv-detail',
        name: 'mvDetail',
        component: MvDetail,
      },
      {
        path: 'playerDetail',
        name: 'playerDetail',
        component: PlayerDetail,
      },
      {
        path: 'personal',
        name: 'personal',
        component: Personal,
      },
      {
        path: 'search',
        name: 'search',
        component: Search,
      },
    ]
  },

]

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  routes
})

export default router
